<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/3/1 0001
 * Time: 23:58
 */
//PHP---引用使用foreach(xxx as &$x)时候的坑。
$data1 = ["1", "2", "3"];
$data2 = ["4", "5", "6"];
$all = 0;
foreach ($data1 as &$x) {

    $all += $x;
}
//echo $all; //6
//#注意这里$x是$data1最后一个元素的引用
$all2 = 0;
foreach ($data2 as $x => $y) {
//    echo $x."\r\n";  //0 1 2
//    echo $data1[$x] . "\r\n"; // 1 2 2
    $all2 += ($y + $data1[$x]); //原意是计算:1+4 + 2+5 + 3+6 的总和,结果应该是21
}
//echo $all2;  //20
$b = 1;
$c = 2;
$a = $b <=> $c;
//echo $a;
//echo $name = $_GET['name'] ?? 'morenzhi';
//define('A',['a','b']);
//echo A['1'];
//uee \a\{classA,\Couchbase\ClassicAuthenticator}
//$arr = [1,2,3];
//foreach ($arr as $val) {
//    unset($arr[1]);
//}
////var_dump($arr);
list($arr[], $arr[], $arr[]) = [1,2,3];
var_dump($arr);
//PHP7新特性总结
//https://blog.csdn.net/wuxing26jiayou/article/details/80036963